﻿using System;
using System.Windows.Forms;
using MediaLibraryManagement.BLL;
using MediaLibraryManagement.Common;
using MediaLibraryManagement.Entity;

namespace MediaLibraryManagement.UI
{
    public partial class AlbumInfoPane : UserControl
    {
        private Album _album;
        private Artist _artist;

        public Album Album
        {
            get { return _album; }
            set { _album = value; }
        }

        public AlbumInfoPane()
        {
            InitializeComponent();
        }

        private void AlbumInfoPane_Load(object sender, EventArgs e)
        {
            if (_album != null)
            {
                ArtistBLL artistBLL = new ArtistBLL();
                _artist = artistBLL.GetArtistByID(_album.ArtistID);
                lblTitle.Text += _album.Title;
                lblGenre.Text += _album.Genre;
                lblArtist.Text += _artist.FirstName + " " + _artist.LastName;
                picAlbumImage.Image = Utilities.ScaleImage(_album.Image, picAlbumImage.Width, picAlbumImage.Height);
            }
        }

        private void lnkViewDetail_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (_artist != null && _album != null)
            {
                AlbumDetails frmAlbumDetails = new AlbumDetails(_artist, _album);
                frmAlbumDetails.ShowDialog();
            }
        }
    }
}